package com.yunxin.admin.system.application.assembler;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunxin.admin.system.application.command.AddDictCommand;
import com.yunxin.admin.system.application.command.AddDictTypeCommand;
import com.yunxin.admin.system.application.command.UpdateDeptCommand;
import com.yunxin.admin.system.application.command.UpdateDictTypeCommand;
import com.yunxin.admin.system.application.dto.DictInfoDTO;
import com.yunxin.admin.system.application.dto.DictPageDTO;
import com.yunxin.admin.system.application.dto.DictTypeInfoDTO;
import com.yunxin.admin.system.application.dto.DictTypePageDTO;
import com.yunxin.admin.system.domain.model.dict.Dict;
import com.yunxin.admin.system.domain.model.dict.DictType;
import com.yunxin.admin.system.infra.persistence.entity.SysDictDO;
import com.yunxin.admin.system.infra.persistence.entity.SysDictTypeDO;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;

/**
 * 字典数据项对象转换器
 *
 * @author zero°
 * @since 2023-05-22
 */
@Mapper(componentModel = "spring")
public interface DictAssembler {

    /**
     * entity 转 dto
     * @param page page
     * @return Page<DictPageDTO>
     */
    Page<DictPageDTO> toDictPageDTO(Page<SysDictDO> page);


    /**
     * entity 转 dto
     * @param entity entity
     * @return DictInfoDTO
     */
    DictInfoDTO toDictInfoDTO(SysDictDO entity);
    /**
     * command 转 entity
     * @param command command
     * @return Dict
     */
    Dict formAddDictCommand(AddDictCommand command);
    /**
     * command 转 entity
     * @param command command
     * @return Dict
     */
    @InheritInverseConfiguration(name="toDictInfoDTO")
    Dict formUpdateDeptCommand(UpdateDeptCommand command);

    /**
     * entity 转 dto
     * @param page page
     * @return Page<DictTypePageDTO>
     */
    Page<DictTypePageDTO> toDictTypePageDTO(Page<SysDictTypeDO> page);
    /**
     * entity 转 dto
     * @param entity entity
     * @return DictTypeInfoDTO
     */
    DictTypeInfoDTO toDictTypeInfoDTO(SysDictTypeDO entity);
    /**
     * command 转 entity
     * @param command command
     * @return SysDictType
     */
    DictType formAddDictTypeCommand(AddDictTypeCommand command);
    /**
     * request 转 entity
     * @param request request
     * @return SysDictType
     */
    @InheritInverseConfiguration(name="toDictTypeInfoDTO")
    DictType formUpdateDeptTypeCommand(UpdateDictTypeCommand request);
}
